﻿<%@ Application Language="VB" %>
<%@ Import Namespace="Cls_Common" %>
<%@ Import Namespace="SecurityService" %>
<script runat="server">
    Private Shared ReadOnly log As log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs on application startup
        Application("OnlineUsers") = 1
        RegisterRouters(System.Web.Routing.RouteTable.Routes)
    End Sub
    
    Sub RegisterRouters(ByVal routers As System.Web.Routing.RouteCollection)
        
        'tim kiem
        routers.MapPageRoute("TimKiem", "tim-kiem.html", "~/FrontEnd/Page/ListOtoByCate.aspx")
        
        
        'up tin tu dong
        routers.MapPageRoute("UpTinTuDong", "tin-tu-dong.html", "~/FrontEnd/Page/RaoVat/TinTuDong.aspx")
        
        routers.MapPageRoute("tinMuaOtoCutaiHCM", "mua-oto-cu-tai-tphcm.html", "~/FrontEnd/Page/TinMua/TinMuaOtoSEO.aspx")
        routers.MapPageRoute("tinBanOtoCutaiHCM", "ban-oto-cu-tai-tphcm.html", "~/FrontEnd/Page/RaoVat/TinBanSEO.aspx")
        routers.MapPageRoute("tinBanOtoCutaiHN", "ban-oto-cu-tai-ha-noi.html", "~/FrontEnd/Page/RaoVat/TinBanSEOHaNoi.aspx")
        routers.MapPageRoute("tinBanOtoCutaiBD", "ban-oto-cu-tai-binh-duong.html", "~/FrontEnd/Page/RaoVat/TinBanSEOBinhDuong.aspx")
        routers.MapPageRoute("tinBanOtoCutaiDN", "ban-oto-cu-tai-da-nang.html", "~/FrontEnd/Page/RaoVat/TinBanSEODaNang.aspx")
        routers.MapPageRoute("tinBanOtoCutaiVT", "ban-oto-cu-tai-vung-tau.html", "~/FrontEnd/Page/RaoVat/TinBanSEOVungTau.aspx")
        
        routers.MapPageRoute("tin-tuc", "tin-oto.html", "~/FrontEnd/Page/News/Home.aspx")
        routers.MapPageRoute("tin-list", "tin-oto/{QueryString}-{Id}.html", "~/FrontEnd/Page/News/ListByMenu.aspx")
        
        routers.MapPageRoute("quanlytin", "quan-ly-tin-salon.html", "~/FrontEnd/Page/News/List.aspx")
        routers.MapPageRoute("taoquanlytin", "tao-tin-salon.html", "~/FrontEnd/Page/News/Create_New.aspx")
        routers.MapPageRoute("chinhsuaquanlytin", "chinh-sua-tin-salon.html", "~/FrontEnd/Page/News/Edit_New.aspx")
        
        
        
        routers.MapPageRoute("tin-tuc_chi-tiet", "chi-tiet/{QueryString}-{Id}.html", "~/FrontEnd/Page/News/Detail.aspx")
        
        routers.MapPageRoute("trangchu", "Index.html", "~/index.aspx")
        
        routers.MapPageRoute("THongbaoTinDang", "thong-bao-tin-dang.html", "~/FrontEnd/Page/ThongBao.aspx")
        'salon
        routers.MapPageRoute("ListSalon", "salon-oto.html", "~/FrontEnd/Page/ListSalonByTinh.aspx")
        routers.MapPageRoute("quanlyRaoVat", "my-oto.html", "~/FrontEnd/Page/Raovat/List.aspx")
        routers.MapPageRoute("quanlySalonOto", "quan-ly-salon-oto.html", "~/FrontEnd/Page/Store/Edit.aspx")
    
        routers.MapPageRoute("dangtinRaoVat", "dang-tin-rao-vat.html", "~/FrontEnd/Page/Raovat/InputFormRaoVat.aspx")
        'Tin mua
        routers.MapPageRoute("danhsachTinmua", "tin-mua-oto.html", "~/FrontEnd/Page/TinMua/TinMuaOto.aspx")
        
       
               
        
        routers.MapPageRoute("quanlyTinMuaTaoMoi", "can-mua-oto.html", "~/FrontEnd/Page/TinMua/Create.aspx")
        routers.MapPageRoute("quanlyTinMuaList", "quan-ly-tin-mua.html", "~/FrontEnd/Page/TinMua/List.aspx")
        routers.MapPageRoute("quanlyTinMuaEdit", "chinh-sua-tin-mua-{Id}.html", "~/FrontEnd/Page/TinMua/Edit.aspx")
        routers.MapPageRoute("quanlyTinMuaChiTiet", "chi-tiet-tin-mua-{Id}.html", "~/FrontEnd/Page/TinMua/Detail.aspx")
        
        
        routers.MapPageRoute("ListSalonOCoHeader", "danh-sach-salon.html", "~/FrontEnd/Page/ListSalon.aspx")
        'Header Menu
        routers.MapPageRoute("thanhvien", "thanh-vien.html", "~/FrontEnd/Page/ThanhVien.aspx")
        
        routers.MapPageRoute("quanlyRaoVatCreate", "dang-tin-ban-oto.html", "~/FrontEnd/Page/RaoVat/Create.aspx")
        routers.MapPageRoute("dangnhap", "dang-nhap.html", "~/FrontEnd/Page/Login.aspx")
        routers.MapPageRoute("dangky", "dang-ky.html", "~/FrontEnd/Page/Register.aspx")
        routers.MapPageRoute("changepassword", "doi-mat-khau.html", "~/FrontEnd/Page/ChangePassword.aspx")
        routers.MapPageRoute("vip", "nang-cap-vip.html", "~/FrontEnd/Page/Vip.aspx")
        routers.MapPageRoute("thongtincanhan", "thong-tin-ca-nhan.html", "~/FrontEnd/Page/Profile.aspx")
        
        routers.MapPageRoute("tinnhanden", "hop-tin-nhan-den.html", "~/FrontEnd/Page/ListTinNhanDen.aspx")
        routers.MapPageRoute("chitiettinnhanden", "tin-nhan-den/{Id}.html", "~/FrontEnd/Page/ChiTietTinNhanDen.aspx")
       
        routers.MapPageRoute("tinhnhandi", "hop-tin-nhan-di.html", "~/FrontEnd/Page/ListTinNhanDi.aspx")
        routers.MapPageRoute("tinhnhandi2", "hop-tin-gui-di.html", "~/FrontEnd/Page/ListTinNhanDi.aspx")
        routers.MapPageRoute("chitiettinnhandi", "tin-nhan-di/{Id}.html", "~/FrontEnd/Page/ChiTietTinNhanDi.aspx")
      
        
        'Tin ban
        
        routers.MapPageRoute("quanlyRaoVatEdit", "chinh-sua-oto-{Id}.html", "~/FrontEnd/Page/RaoVat/Edit.aspx")
        routers.MapPageRoute("quanlyRaoVatView", "chi-tiet-oto-{Id}.html", "~/FrontEnd/Page/RaoVat/Detail.aspx")
        routers.MapPageRoute("guiTinNhan", "gui-tin-nhan.html", "~/FrontEnd/Page/GuiTinNhan.aspx")
        routers.MapPageRoute("baoTinSai", "bao-tin-sai.html", "~/FrontEnd/Page/BaoTinSai.aspx")
      
        'Salon
        routers.MapPageRoute("quanlySalon", "my-salon.html", "~/FrontEnd/Page/Store/List.aspx")
        routers.MapPageRoute("quanlySalonEdit", "chinh-sua-salon-{Id}.html", "~/FrontEnd/Page/Store/Edit.aspx")
        routers.MapPageRoute("quanlySalonView", "chi-tiet-salon-{Id}.html", "~/FrontEnd/Page/Store/Detail.aspx")
       
     
      
        

        
        'Oto
        routers.MapPageRoute("TimOto", "tim-mua-oto.html", "~/FrontEnd/Page/ListOtoByCate.aspx")
        routers.MapPageRoute("ListOtoByCate", "ban-oto/{QueryString}-{Id}.html", "~/FrontEnd/Page/ListOtoByCate.aspx")
        routers.MapPageRoute("ChiTietBanOto", "{QueryString}-{Id}.html", "~/FrontEnd/Page/RaoVat/Preview.aspx")
        
        routers.MapPageRoute("Content", "content/{QueryString}-{Id}.html", "~/FrontEnd/Page/Content.aspx")
        'salon trang chu
        routers.MapPageRoute("SalonTrangChu", "salon-oto/{QueryString}-{Id}.html", "~/FrontEnd/Page/StoreHome.aspx")
        'salon trang chu
        routers.MapPageRoute("SalonGioiThieu", "salon-oto/{QueryString}-{Id}/gioi-thieu.html", "~/FrontEnd/Page/StoreIntro.aspx")
        routers.MapPageRoute("SalonXeDangBan", "salon-oto/{QueryString}-{Id}/xe-dang-ban.html", "~/FrontEnd/Page/StoreCar.aspx")
        routers.MapPageRoute("SalonBanDo", "salon-oto/{QueryString}-{Id}/ban-do.html", "~/FrontEnd/Page/StoreBanDo.aspx")
        routers.MapPageRoute("SalonLienHe", "salon-oto/{QueryString}-{Id}/lien-he.html", "~/FrontEnd/Page/StoreLienHe.aspx")
        
        'chi tiet tin salon
        routers.MapPageRoute("SalonDetailView", "{QueryString}-{Id}/{QueryString2}-{RaoVatId}.html", "~/FrontEnd/Page/Raovat/PreViewSalon.aspx")
        
        
        
    End Sub
    Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs on application shutdown
    End Sub
        
    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs when an unhandled error occurs
        'Dim serverError As HttpException = Server.GetLastError()
        'Dim errorCode As Integer
        'If (Not serverError Is Nothing) Then
        '    errorCode = serverError.ErrorCode
        'End If
        'If errorCode = 404 Then
        '    Server.ClearError()
        '    Server.Transfer( MainDomain & "/Errors/404.aspx")
        'End If
   
      
      
    End Sub

    
    Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs when a new session is started
        Session("UserName") = Nothing
        Session("UserID") = Nothing
        Session("RoleID") = Nothing
        Session("MenuId") = Nothing
        Session("UserCode") = Nothing
        Session("LanguageId") = 1
        
    End Sub

    Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs when a session ends. 
        ' Note: The Session_End event is raised only when the sessionstate mode
        ' is set to InProc in the Web.config file. If session mode is set to StateServer 
        ' or SQLServer, the event is not raised.
        Session("UserName") = Nothing
        Session("MenuId") = Nothing
        Session("UserCode") = Nothing
    End Sub
       
</script>